package com.ucap.weking.guangan.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;

import java.util.ArrayList;

/**
 * Created by weking on 2017/10/17.
 */

public class ViewPagerAdapter extends FragmentStatePagerAdapter {
    ArrayList<Fragment> mContent;
    String[] title;

    public ViewPagerAdapter(FragmentManager fm, ArrayList<Fragment> mContent, String[] title) {
        super(fm);
        this.mContent = mContent;
        this.title = title;
    }

    public ViewPagerAdapter(FragmentManager fm, ArrayList<Fragment> mContent) {
        super(fm);
        this.mContent = mContent;
    }

    @Override
    public Fragment getItem(int position) {
        return mContent.get(position);
    }

    @Override
    public int getCount() {
        return mContent.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return title[position];
    }
}
